package com.cm.stock.manager.dto;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@SuppressWarnings("serial")
@Entity
@Table(name = "commande",uniqueConstraints={@UniqueConstraint(columnNames={"code"})})
public class CommandeDTO implements Serializable{

	@Id
	@Column(name = "ID", nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	@Column(length=25, nullable=false)
	private String code	;
	private double montantBrut;
	private double montantNet;
	private Date dateEdition;
	private Date dateRendezvous;	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "client_Id",nullable=false)
	private ClientDTO client;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "user_Id",nullable=false)
	private UserDTO user;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public double getMontantBrut() {
		return montantBrut;
	}
	public void setMontantBrut(double montantBrut) {
		this.montantBrut = montantBrut;
	}
	public double getMontantNet() {
		return montantNet;
	}
	public void setMontantNet(double montantNet) {
		this.montantNet = montantNet;
	}
	public Date getDateEdition() {
		return dateEdition;
	}
	public void setDateEdition(Date dateEdition) {
		this.dateEdition = dateEdition;
	}
	public Date getDateRendezvous() {
		return dateRendezvous;
	}
	public void setDateRendezvous(Date dateRendezvous) {
		this.dateRendezvous = dateRendezvous;
	}
	public ClientDTO getClient() {
		return client;
	}
	public void setClient(ClientDTO client) {
		this.client = client;
	}
	public UserDTO getUser() {
		return user;
	}
	public void setUser(UserDTO user) {
		this.user = user;
	}
	public CommandeDTO(String code, double montantBrut, double montantNet,
			Date dateEdition, Date dateRendezvous, ClientDTO client,
			UserDTO user) {
		super();
		this.code = code;
		this.montantBrut = montantBrut;
		this.montantNet = montantNet;
		this.dateEdition = dateEdition;
		this.dateRendezvous = dateRendezvous;
		this.client = client;
		this.user = user;
	}
	public CommandeDTO() {
		super();
	}
	
	

}
